<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.2.0/axios.min.js"></script>
  <script>
    console.log(axios('http://hmajax.itheima.net/api/province'), 444);
  </script>

  <script>
    const p = new Promise((resolve, reject) => {
      // resolve===成功===函数
      // reject====失败====函数
      /* 如果 执行resolve又执行reject 谁在前面就走谁 */
      resolve(2)
      reject(1)
    })
    console.log(p, 123);
    p.then((res) => {
      /* 成功的回调
      .then() 中的箭头回调函数就是 resolve
      回调函数的参数接受的就是 resolve传的实参
      */
      console.log(res, 111);
    }).catch(err => {
      // 失败的回调
      console.log(err, 222);
    }).finally(res => {
      /* 不管成功还是失败都会执行 */
      console.log(res, 333);
    })

    /* 只有Promise才有.then函数 */
  </script>
</body>

</html>